from A3mall.Base.Base import Base
from selenium.webdriver.common.by import By
import time
class Page(Base):
    #点击登录
    login_loc=(By.LINK_TEXT,'登录')
    def login(self):
        self.click(self.login_loc)
    #断言1：断言文本：员工登录
    dy1_loc=(By.XPATH,'//*[contains(text(),"员登")]')
    def dy1(self):
        return self.text(self.dy1_loc)
    #输入用户名或手机号
    username_loc=(By.CLASS_NAME,'regi-input')
    def username(self):
        self.send_keys(self.username_loc,'13051749131')
    #输入密码
    password_loc=(By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'123456')
    #点击登录按钮
    login_btn_loc=(By.CSS_SELECTOR,'.finish-btn')
    def login_btn(self):
        self.click(self.login_btn_loc)


    #调用页面元素和操作方法
    def luoji_a3mall_01_login(self):
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        self.driver.implicitly_wait(10)
        assert '会员登录' == self.dy1()
        print('断言1：文本"会员登录":',self.dy1())
        self.username()
        self.password()
        time.sleep(10)
        self.login_btn()
        time.sleep(2)